In [6]:
import numpy as np
import matplotlib as plt
from scipy.optimize import leastsq
In [7]:
def Rabi_fit(t,par):
""" Program to fit Rabi Oscillation
par : A,B,C,D,E
"""
A,B,C,D,E = par
F = A + B*np.exp(-t/C)*np.cos(2*np.pi*t/D + E)
return F
def residual(data, t , par):
""" Minimize function
"""
diff = Rabi_fit(t,par) - dat
return diff
In [10]:
ls
In [ ]:
In [ ]:
A =
B =
C =
D =
E =
In [9]:
par_init = A, B, C, D, E
best, cov, info, message, ier = leastsq(residual, par_init, args=(Data),\
full_output=True,ftol=1e-15,xtol=1e-15,gtol=1e-12, maxfev=100000 )
In [ ]: